package edu.must.uh.util;
import java.text.SimpleDateFormat;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import edu.must.uh.bean.DeployQueryResultBean;

public class ServletUtils {
    
    
    public static Map<String, Object> getsearchcondition(HttpServletRequest  request) {
        String searchconditionString =ToolsOfString.NulltoEmpty(request.getParameter("searchcondition")) .replace('“', '"') ;      
        JSONObject jzJsonObject= JSON.parseObject(searchconditionString); 
        Map<String, Object>  searchcondition = jzJsonObject; 
        if(searchcondition !=null && !searchcondition.isEmpty()) {
           for (String key : searchcondition.keySet()) {
               Object value = searchcondition.get(key);
               String _value = ToolsOfString.conveString(value);
               searchcondition.put(key, _value);               
           }
        }
        return searchcondition;
    }
    
  
    
    public static void createTimeHelper(Map<String, Object>  map,String field) {
        Object createTime = map.get(field);
        if(createTime !=null) {
            String result2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTime);
           map.put("S_"+field, result2); 
        }else {
            map.put("S_"+field, ""); 
        }
    } 
    
    public static void createDateHelper(Map<String, Object>  map,String field) {
        Object createTime = map.get(field);
        if(createTime !=null) {
            String result2 = new SimpleDateFormat("yyyy-MM-dd").format(createTime);
           map.put("S_"+field, result2); 
        }else {
            map.put("S_"+field, ""); 
        }
    }
    
    
    

}
